// src/pages/article/widgets/follow/index.tsx
import styles from "@pages/article/styles/styles.module.less";
import { useFollowUserMutation, useUnFollowUserMutation } from "@service/user";
import classNames from "classnames";

interface Props {
  isFollow: boolean;
  userId: string;
  id:string
  isCollect:boolean | undefined
}

export default function Follow({ isFollow, userId }: any) {
  const [follow] = useFollowUserMutation();
  const [unFollow] = useUnFollowUserMutation();
  const requestFollow = () => {
    isFollow ? unFollow(userId) : follow(userId);
  };
  return (
    <button
      onClick={requestFollow}
      className={classNames({ [styles.active]: isFollow })}
    >
      关注
    </button>
  );
}